package com.tdkj.action.backstage.shop;

import java.util.List;

import javax.annotation.Resource;

import com.opensymphony.xwork2.ActionSupport;
import com.tdkj.model.shop.BeanShopRecommendation;
import com.tdkj.service.shop.IBeanShopRecommendationService;

public class ShopRecommendationAction extends ActionSupport {

	private IBeanShopRecommendationService shopRecommendationService ;

	/**
	 * @param shopRecommendationService the shopRecommendationService to set
	 */
	@Resource
	public void setShopRecommendationService(
			IBeanShopRecommendationService shopRecommendationService) {
		this.shopRecommendationService = shopRecommendationService;
	}
	
	private Long customId ;
	private Long shopId ;
	private List<BeanShopRecommendation> shopRecommendations;
	
	public String execute(){
		
		if(customId == null){
			shopRecommendations = shopRecommendationService.getAll();
		}else{
			shopRecommendations = shopRecommendationService.getByCustomId(customId);
		}
		
		return "success";
	}
	
	public String add(){
		
		shopRecommendationService.add(customId, shopId);
		return execute();
	}

	/**
	 * @return the customId
	 */
	public Long getCustomId() {
		return customId;
	}

	/**
	 * @param customId the customId to set
	 */
	public void setCustomId(Long customId) {
		this.customId = customId;
	}

	/**
	 * @return the shopId
	 */
	public Long getShopId() {
		return shopId;
	}

	/**
	 * @param shopId the shopId to set
	 */
	public void setShopId(Long shopId) {
		this.shopId = shopId;
	}

	/**
	 * @return the shopRecommendations
	 */
	public List<BeanShopRecommendation> getShopRecommendations() {
		return shopRecommendations;
	}

	/**
	 * @param shopRecommendations the shopRecommendations to set
	 */
	public void setShopRecommendations(
			List<BeanShopRecommendation> shopRecommendations) {
		this.shopRecommendations = shopRecommendations;
	}
	
}
